<?php
/**
 * Created by PhpStorm.
 * User: alice
 * Date: 2015/12/28
 * Time: 12:26
 */

/**
 * Class Involved_ArticleModel
 */

class Involved_ArticleModel extends BaseModel{

    protected $table = 'article';

    /*************************   APP 接口   *****************************/


    public function GetBankrollList()
    {
        return  DB::table($this->table)
            ->join('help_center','article.rec_id','=','help_center.rec_id')
            ->select('article_title','brief','author','article.content')
            ->where('article.rec_id','help_center.rec_id')
            ->get();
    }



    /**
     * 获取文章详情
     * @return
     */
    public function GetArticleDetail($article_id)
    {
        return  DB::table($this->table)->where('article_id',$article_id)
                ->select('article_title','source','created','content','thumb_img')
                ->first();
    }

    /**
     * 获取木业资讯列表
     * @return
     */
    public function GetInformationList()
    {
        return  DB::table($this->table)
                ->join('article_cate','article.cate_id','=','article_cate.cate_id')
                ->select('article_title','brief','thumb_img')
                ->where('article_cate.cate_name','木业资讯')
                ->get();
    }

    /**
     * 木投简介
     * @return
     */
    public function MuTou()
    {
        return  DB::table($this->table)
            ->join('article_cate','article.cate_id','=','article_cate.cate_id')
            ->select('content')
            ->where('article_cate.cate_name','关于木投')
            ->first();
    }

    /**
     * 文章列表
     * @return
     */
    public function ShowArticleList()
    {
        $info =  DB::table($this->table)->get();
        foreach($info as $k => $v)
        {
            $v->created = date('Y-m-d');
        }
        return $info;
    }















}